const schedule = require('node-schedule')
const PddService = require('@/routes/ws/service/pdd/service')

// 设置定时任务，每隔1小时执行一次
function startSchedule() {
    const job = schedule.scheduleJob('0 * * * *', async () => {
        const values = await client.mget(keys)
        values.map(async (value) => {
            let obj = JSON.parse(value)
            const service = new PddService(obj.cookie)
            // 请求获取商家信息
            await service.realtime()
        })
    })
    return job
}

module.exports = { startSchedule }
